import { Controller, Get, Version } from '@nestjs/common';
import { AppService } from './app.service';
import { BusinessException } from './common/filter/business-exception/business.exception';

@Controller('app')
export class AppController {
  constructor(private readonly appService: AppService) {}

  @Get()
  // @Version('1')
  getHello(): string {
    return 'Hello World version';
  }

  @Get()
  @Version('3')
  getHello2(): string {
    return 'Hello World version3';
  }

  @Get('test')
  // @Version('1')
  getHello3(): string {
    return this.appService.getHello();
  }
  @Get('findError')
  findError() {
    try {
      const a: any = {};
      console.log(a.b.c);
    } catch (error) {
      throw new BusinessException('你的参数错了');
    }
    return this.appService.getHello();
  }
}
